#ifndef __VIDEO_BASE_H__
#define __VIDEO_BASE_H__
#include "stdint.h"
#include "video_memory.h"
#include "memory_pool.h"

struct MemoryFrameIns
{
    int32_t solt_id;
    int32_t buf_size;
    int32_t type;
    int32_t max_num;
    int32_t w;
    int32_t h;
    int32_t w_stride;
    int32_t h_stride;
};

struct MemoryFrame;

struct FrameOps
{
    int32_t (*add_ref)( void *frames );
    int32_t (*dec_ref)( void *frames );
    int32_t (*set_ts)( void *frames, int64_t ts );
};

struct MemoryFrame
{
    void *frame;
    uint8_t *addr;
    int32_t size;
    int32_t type;
    int32_t w;
    int32_t h;
    int32_t w_stride;
    int32_t h_stride;
    int32_t timestamp;
    struct FrameOps ops;
};


enum FRAME_TYPE{
    VID_FRAME_TYPE_NV12 = 0,
    VID_FRAME_TYPE_NV21,
    VID_FRAME_TYPE_I410,

    VID_FRAME_TYPE_MJPEG,
    VID_FRAME_TYPE_H264,
};


typedef void *MEM_BASE_HANDLE;

#ifdef __cplusplus
extern "C" {
#endif

int32_t memory_base_create_fq( int32_t w, int32_t h, int32_t w_stride, int32_t h_stride, FRAME_TYPE type, int32_t num, MEM_BASE_HANDLE *handle );
int32_t memory_base_fq_acquire( MEM_BASE_HANDLE handle, struct MemoryFrame *frame );
int32_t memory_base_destory_fq( MEM_BASE_HANDLE handle );

#ifdef __cplusplus
}
#endif



#endif
